package com.itjason.controller;

import com.itjason.service.WxRegionalDialectPageService;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * Author:JasonLong
 * Date:2023/5/11
 * Time:17:57
 * 地区方言页面控制类
 */
@RestController
@RequestMapping("/wx/regin")
public class WxRegionalDialectPageController {

    @Autowired
    private WxRegionalDialectPageService regionalDialectPageService;

    /**
     * @param regionFlag
     * @return List
     * 该接口提供小程序获取地区方言的信息列表
     */
    @ApiOperation(value = "获取地区方言数据接口")
    @ApiImplicitParam(name = "regionFlag", value = "地区标记参数", dataType = "String", paramType = "query")
    @GetMapping("/regionList")
    public List getRegionLanguagePack(@RequestParam String regionFlag) {
        System.out.println(regionFlag);
        return regionalDialectPageService.getRegionLanguagePack(regionFlag);
    }

    @ApiOperation(value = "地区方言查询接口")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "keyword", value = "地区方言搜索关键字", dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "regionFlag", value = "地区标记参数", dataType = "String", paramType = "query")
    })
    @GetMapping("/regionQuery")
    public List getRegionDataByKeyword(@RequestParam String keyword, @RequestParam String regionFlag) {
        return regionalDialectPageService.getRegionDataByKeyword(keyword, regionFlag);
    }

}
